//
//  PrefixHeader.h
//  基本框架
//
//  Created by runone02 on 2018/6/29.
//  Copyright © 2018年 liqiyun. All rights reserved.
//

#ifndef PrefixHeader_h
#define PrefixHeader_h

#ifdef DEBUG
#define NSLog(FORMAT, ...) fprintf(stderr,"%s:%d\t%s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
#else
#define NSLog(FORMAT, ...) nil
#endif

#define kIphone6Height 667.0

#define kIphone6Width 375.0
#define YouLikeLineCount 2
#define YouLikeCellW ((SScreen_Width - YouLikeInset * (YouLikeLineCount - 1)) / YouLikeLineCount) * 1.0
#define YouLikeInset kFit(6)
#define YouLikeCellH kFit((250 - YouLikeInset))
#define SScreen_Width [UIScreen mainScreen].bounds.size.width
#define SScreen_Height [UIScreen mainScreen].bounds.size.height
#define kFit(x) (SScreen_Width*((x)/kIphone6Width))

#define TextSize kFit(16)
#define FIT_WIDTH   [UIScreen mainScreen].bounds.size.width/375
#define FIT_HEIGHT  [UIScreen mainScreen].bounds.size.height/667
#define placeholderFailImage [YYImage imageWithColor:[ZMColor colorWithHexString:@"#ECECEC"]]
//default_avatar
#define placeholderAvatarImage [UIImage imageNamed:@"default_avatar"]
#define backArrowIcon          [UIImage imageNamed:@"navigation_back"]
#define backArrowWhiteIcon     [UIImage imageNamed:@"navigation_back_white"]

#define kDevice_Is_iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)

#define KStatusBarHeight (kDevice_Is_iPhoneX ? 24.f:0.f)
#define KStatusBarMargin (kDevice_Is_iPhoneX ? 22.f:0.f)
#define KTabBarHeight    (kDevice_Is_iPhoneX ? 34.f:0.f)

#define pageMenuH 40
#define NaviH (kScreenHeight == 812 ? 88 : 64) // 812是iPhoneX的高度
#define KWaterSpace     3.0
#define KMarginLeft     12.0
#define KMarginRight    20.0
#define sizePercent 0.05
#define OFFSET_Y 15.0
#define IMAGE_NUMBER 9
#define DISTANCE_X 60.0
#define WEAKSELF __weak typeof(self) weakSelf = self
#define BLOCKSELF __block typeof(self)weakSelf = self

/** 通知 */
/** 登录状态改变（登录退出） */
#define KLoginStateChangeNotice     @"KLoginStateChangeNotice"
/** 更新用户资料 */
#define KUpdateUserInfoNotice       @"KUpdateUserInfoNotice"

/** API */
/** 发现-推荐 */
#define HttpImageURLPre                    @"https://gacha.nosdn.127.net/"
#define HttpImageURLSuffixSquare           @"?imageView&enlarge=1&quality=75&thumbnail=750y750&type="
#define HttpImageURLSuffixScanle(width,height)           @"?imageView&enlarge=1&quality=75&thumbnail="width@"y"height@"&type="

#define BaseURL                            @"https://api.gacha.163.com/api/v1"
#define BaseURLV2                          @"https://api.gacha.163.com/api/v2"

/** 发现 - 推荐 */
#define DiscoveryRecommendInfo             BaseURL@"/discovery"
/** 发现 - 热推更多 */
#define DiscoveryNextNewRecommend          BaseURL@"/discover/nextNewRecommend"
/** 发现 - 插画、文章、COS */
#define DiscoveryInsetInfo                 BaseURL@"/discovery/post"
/** 发现 - 插画、文章、COS - 下一页 */
#define DiscoveryInsetNextPopularPosts     BaseURL@"/discover/nextPopularPosts"
/** 发现 - 排行 */
#define DiscoveryRankingList               BaseURL@"/rankingList"
/** 发现 - 专题详情信息 */
#define DiscoverTopicCollectInfo           BaseURL@"/collect/info"
/** 发现 - 专题用户信息 */
#define DiscoverTopicUserInfo              BaseURL@"/user/detailInfo"
/** 发现 - 专题帖子列表 */
#define DiscoverTopicSublist               BaseURLV2@"/collect/sublist"

/** 帖子详情 */
#define PostDetailInfo                     BaseURL@"/post/V2"
/** 喜欢这个帖子相关的人 */
#define PostSupportUsersList               BaseURL@"/post/supportUsers"
/** 帖子热评 */
#define PostHotcommentsList                BaseURL@"/post/hotcomments"
/** 帖子评论分页 */
#define PostCommentsList                   BaseURL@"/post/comments"

#define PFR [[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0 ? @"PingFangSC-Regular" : @"PingFang SC"

/** 其他 */


#define UserInfoData [DCUserInfo findAll].lastObject
#endif /* PrefixHeader_h */
